<?php
/*
 * @Homepage for application
 * @verion 1.0
 * @author Roshan
 */
class Application extends base {
	
	protected $_view;
	
	public function __construct() {
		$this->setView ();
	}
	public function run($view = '') {
		$this->setView ( $view );
		// Do business Logic
		$categories = Model_Mapper_Categories::newInstance ()->tree ();
		view::newInstance ()->_exportVariableToView ( 'main_categories', $categories );
		$location = Model_Mapper_Locations::newInstance ()->getBySlug ( Params::getParam ( 'slug' ) );
		
		$toTreeRoot=$location->toRoot();
		foreach($toTreeRoot as $item){
			Breadcrumb::newInstance()->add($item->getName(),$item->getURI());
		}
		$items=$location->getItems();
		view::newInstance ()->_exportVariableToView ( 'items', $items );
		$this->setView ( 'location.phtml' );
		$this->dispatch ();
	}

}